import 'package:fluent_ui/fluent_ui.dart';
import 'package:fnos_tv_desktop/core/api/bean/user_info_result.dart';

class UserInfo extends ChangeNotifier {
  String? guid;
  String? username;
  String? lan;
  bool isAdmin = false;
  int? lastLoginTime;
  List<Sources>? sources;

  void update(UserInfoResult result) {
    guid = result.guid;
    username = result.username;
    lan = result.lan;
    isAdmin = result.isAdmin == 1;
    lastLoginTime = result.lastLoginTime;
    sources = result.sources;
    notifyListeners();
  }

  void clear() {
    guid = null;
    username = null;
    lan = null;
    isAdmin = false;
    lastLoginTime = null;
    sources = null;
    notifyListeners();
  }
}
